<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Eigen: Eigen::ScalarBinaryOpTraits&lt; ScalarA, ScalarB, BinaryOp &gt; Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="eigendoxy.css" rel="stylesheet" type="text/css">
<!--  -->
<script type="text/javascript" src="eigen_navtree_hacks.js"></script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="Eigen_Silly_Professor_64x64.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname"><a href="http://eigen.tuxfamily.org">Eigen</a>
   &#160;<span id="projectnumber">3.4.90 (git rev 67eeba6e720c5745abc77ae6c92ce0a44aa7b7ae)</span>
   </div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.svg"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('structEigen_1_1ScalarBinaryOpTraits.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Eigen::ScalarBinaryOpTraits&lt; ScalarA, ScalarB, BinaryOp &gt; Class Template Reference<div class="ingroups"><a class="el" href="group__DenseMatrixManipulation__chapter.html">Dense matrix and array manipulation</a> &raquo; <a class="el" href="group__DenseMatrixManipulation__Reference.html">Reference</a> &raquo; <a class="el" href="group__Core__Module.html">Core module</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><h3>template&lt;typename ScalarA, typename ScalarB, typename BinaryOp = internal::scalar_product_op&lt;ScalarA,ScalarB&gt;&gt;<br />
class Eigen::ScalarBinaryOpTraits&lt; ScalarA, ScalarB, BinaryOp &gt;</h3>

<p>Determines whether the given binary operation of two numeric types is allowed and what the scalar return type is. </p>
<p>This class permits to control the scalar return type of any binary operation performed on two different scalar types through (partial) template specializations.</p>
<p>For instance, let <code>U1</code>, <code>U2</code> and <code>U3</code> be three user defined scalar types for which most operations between instances of <code>U1</code> and <code>U2</code> returns an <code>U3</code>. You can let Eigen knows that by defining: </p><div class="fragment"><div class="line"><span class="keyword">template</span>&lt;<span class="keyword">typename</span> BinaryOp&gt;</div>
<div class="line"><span class="keyword">struct </span>ScalarBinaryOpTraits&lt;U1,U2,BinaryOp&gt; { <span class="keyword">typedef</span> U3 ReturnType;  };</div>
<div class="line"><span class="keyword">template</span>&lt;<span class="keyword">typename</span> BinaryOp&gt;</div>
<div class="line"><span class="keyword">struct </span>ScalarBinaryOpTraits&lt;U2,U1,BinaryOp&gt; { <span class="keyword">typedef</span> U3 ReturnType;  };</div>
</div><!-- fragment --><p> You can then explicitly disable some particular operations to get more explicit error messages: </p><div class="fragment"><div class="line"><span class="keyword">template</span>&lt;&gt;</div>
<div class="line"><span class="keyword">struct </span>ScalarBinaryOpTraits&lt;U1,U2,internal::scalar_max_op&lt;U1,U2&gt; &gt; {};</div>
</div><!-- fragment --><p> Or customize the return type for individual operation: </p><div class="fragment"><div class="line"><span class="keyword">template</span>&lt;&gt;</div>
<div class="line"><span class="keyword">struct </span>ScalarBinaryOpTraits&lt;U1,U2,internal::scalar_sum_op&lt;U1,U2&gt; &gt; { <span class="keyword">typedef</span> U1 ReturnType; };</div>
</div><!-- fragment --><p>By default, the following generic combinations are supported: </p><table class="manual">
<tr>
<th>ScalarA</th><th>ScalarB</th><th>BinaryOp</th><th>ReturnType</th><th>Note </th></tr>
<tr>
<td><code>T</code> </td><td><code>T</code> </td><td><code>*</code> </td><td><code>T</code> </td><td></td></tr>
<tr class="alt">
<td><code>NumTraits&lt;T&gt;::Real</code> </td><td><code>T</code> </td><td><code>*</code> </td><td><code>T</code> </td><td>Only if <code>NumTraits&lt;T&gt;::IsComplex</code>  </td></tr>
<tr>
<td><code>T</code> </td><td><code>NumTraits&lt;T&gt;::Real</code> </td><td><code>*</code> </td><td><code>T</code> </td><td>Only if <code>NumTraits&lt;T&gt;::IsComplex</code>  </td></tr>
</table>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classEigen_1_1CwiseBinaryOp.html" title="Generic expression where a coefficient-wise binary operator is applied to two expressions.">CwiseBinaryOp</a> </dd></dl>
</div><hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="XprHelper_8h_source.html">XprHelper.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespaceEigen.html">Eigen</a></li><li class="navelem"><a class="el" href="structEigen_1_1ScalarBinaryOpTraits.html">ScalarBinaryOpTraits</a></li>
    <li class="footer">Generated on Thu Apr 21 2022 13:07:56 for Eigen by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
